<?php 
	$siteConfig = new Zendvn_Model_Table_SiteConfig();
	$siteConfig = $siteConfig->getItem(array('id' => 1));
	
	$arrYahoo	= explode(',', $siteConfig['yahoo']);
	if(!empty($arrYahoo)){
		$xhtmlYahoo = '';
		foreach ($arrYahoo as $k => $v){
			$v = trim($v);
			$status = Zendvn_CheckOnline::yahoo($v);
			$statusIcon = TEMPLATE_URL . '/public/default/images/icon-yahoo.png';
			if(!$status){
				$statusIcon = TEMPLATE_URL . '/public/default/images/icon-yahoo-offline.png';
			}
			$xhtmlYahoo .= '<div class="lev">
								<a href="ymsgr:sendIM?' . $v . '" class="online">
									<img width="48" height="48" alt="" src="' . $statusIcon . '"><span class="name">' . $v . '</span>
								</a>
							</div>';
		}
	}
	
	$arrSkype	= explode(',', $siteConfig['skype']);
	if(!empty($arrSkype)){
		$xhtmlSkype = '';
		foreach ($arrSkype as $k => $v){
			$v = trim($v);
			$status = Zendvn_CheckOnline::skype($v);
			$statusIcon = TEMPLATE_URL . '/public/default/images/icon-skype.png';
			if(!$status){
				$statusIcon = TEMPLATE_URL . '/public/default/images/icon-skype-offline.png';
			}
			$statusIcon = TEMPLATE_URL . '/public/default/images/icon-skype.png';
			$xhtmlSkype .= '<div class="lev">
								<a href="skype:' . $v . '?chat" class="online">
									<img width="48" height="48" alt="" src="' . $statusIcon . '"><span class="name">' . $v . '</span>
								</a>
							</div>';
		}
	}
	
	$arrPhone	= explode(',', $siteConfig['phone']);
	if(!empty($arrPhone)){
		$xhtmlPhone = '';
		foreach ($arrPhone as $k => $v){
			$v = trim($v);
			$statusIcon = TEMPLATE_URL . '/public/default/images/icon-phone.png';
			$xhtmlPhone .= '<div class="lev">
								<a href="javascript:void(0)" class="online">
									<img width="48" height="48" alt="" src="' . $statusIcon . '"><span class="name">' . $v . '</span>
								</a>
							</div>';
		}
	}
	
	
?>
<div class="support">
	<div class="support-bg" title="Hỗ trợ trực tuyến từ chans.vn"></div>
	<div class="support-contain">
		<?php echo $xhtmlYahoo . $xhtmlSkype . $xhtmlPhone?>
		
			
		
	</div>
</div>



<script>
	$(document).ready(function(){
		$('.support').css('border-radius', '20px');
		$(".support-bg").tipTip({
			maxWidth: "auto", 
			defaultPosition: "left",
			delay: 200,
			edgeOffset: 10
			});
		$('.support-bg').click(function(){
			if($('.support-contain').css('display') == 'none'){
				$('.support').css('border-radius', '20px 0px 0px 20px');
			}else{
				$('.support').css('border-radius', '20px');
			}
			$('.support-contain').toggle(500,function(){
				marginTop = '0px';
				if(parseInt($('.support').css('height')) > 0){
					var marginTop = (parseInt($('.support').css('height'))/2 - parseInt($('.support-bg').css('height'))/2) + 'px';
				}
				$('.support-bg').animate({'margin-top': marginTop}, 500);
			});
			
		})
	})
</script>	